package com.practice;

public class demo14 {
    public static void main(String[] args) {
        //定义sum累加所有满足条件的整数
        int sum = 0;
        //定义计数器，记录满足条件的整数的个数
        int count = 0;
        for (int i = 1; i <= 100; i++) {
            if (i % 3 == 0 && i % 5 == 0) {
                sum += i;
                count++;
            }
            if (count == 3) {
                System.out.println(sum);
                break;
            }
        }
    }
}